<template>
  <div class="detail-logistics">
    <p>
        <span>{{list[0].time}}</span>
        <span>预计送达时间</span>
    </p>
    <a @click="$emit('on-logistics', order)" href="javascript:;">查看物流</a>
  </div>
  <OrderLogistics ref="logisticsOrderCom" />
</template>

<script>
import {ref} from 'vue'
import { logisticsOrder}from '@/api/order'
import { useLogistics } from '../index'
import OrderLogistics from './order-logistics.vue'
export default {
    name:'DetailLogistics',
    components:{OrderLogistics},
    emits:['on-logistics'],
    props: {
        order: {
            type:Object,
            default:()=>({})
        }
    },
    // 组件实例化的时候需要执行setup，因为需要返回渲染模版需要的数据。
    async setup(props) {
        const data = await logisticsOrder(props.order.id)
        const list = ref(data.result.list)

        
        return { list, ...useLogistics() }
    }
}
</script>

<style lang="less" scoped>
.detail-logistics {
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 30px;
    background-color: #f5f5f5;
    margin: 30px 50px 0;
    text-align: left;
    > p {
        flex: 1;
        span {
            color: #999;
            &:first-child {
                margin-right: 30px;
            }
        }
    }
    > a {
        color: @tiziColor;
        text-align: center;
    }
}
</style>